﻿CREATE PROCEDURE [dbo].[thuan_qtthemmenu]         
@TenMenu as nvarchar(255),          
@TenModule as nvarchar(255),          
@TenForm as nvarchar(255),          
@DienGiai as nvarchar(255),          
@Hinh as image =null,          
@MaLoaiMenu as int   ,      
@TenThuMuc as nvarchar(50)       
AS          
declare @dem as int  
if(@TenForm <>'$$$$$' and @TenModule<>'$$$$$' and @TenThuMuc<>'$$$$$')  
begin       
select @dem=COUNT(*) from DanhMuc_Menu where TenForm =@TenForm and TenModule=@TenModule and TenThuMuc=@TenThuMuc   
end      
if(@dem >0)          
begin          
select ErrCode=0          
end          
else          
begin          
insert into DanhMuc_Menu(  
TenMenu,          
TenModule,          
TenForm ,          
DienGiai ,          
Hinh ,          
MaLoaiMenu    ,      
TenThuMuc    
)values(  
@TenMenu ,          
@TenModule ,          
@TenForm ,          
@DienGiai ,          
@Hinh ,          
@MaLoaiMenu    ,      
@TenThuMuc    
)          
select ErrCode=1          
end  